import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:hc_bot_pro/guide/state.dart';
import 'package:lottie/lottie.dart';

import 'index.dart';

class GuidePage extends GetView<GuideController> {
  const GuidePage({super.key});

  // 主视图
  Widget _buildView() {
    return PopScope(
      canPop: controller.state.canPopback,
      onPopInvokedWithResult: (didPop, result) {
        debugPrint("GuidePage onPopInvokedWithResult $didPop");
      },
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          LottieBuilder.asset("assets/images/robot_guide.json", width: 205.w),
          Text(
            "导航中......",
            style: TextStyle(fontSize: 28.sp, color: Colors.white),
          ),
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    final dst = Get.arguments.toString();

    return GetBuilder<GuideController>(
      init: GuideController(GuidePageState(dst: dst)),
      id: "guide",
      builder: (_) {
        return _buildView();
      },
    );
  }
}
